<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>学生登录</title>
    <link rel="stylesheet" href="../css/login.css">
    <script type="text/javascript" src="../js/jquery.min.js"></script>

    <script type="text/javascript" src="../js/jquerysession.js"></script>
    <script src="../lib/layui/layui.js" charset="utf-8"></script>
</head>
<body class="login-bg">

<div class="login">
    <div class="message">学生登录</div>
    <div id="darkbannerwrap"></div>
    <div id="dc_login_form" method="post" class="layui-form">
        <input id="username" name="username" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
        <hr class="hr15">
        <input id="password" name="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
        <hr class="hr15">
        <input id="login_btn" value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr20" >
    </div>
</div>
<script>
    $("#login_btn").click(function () {
        console.log($("#username").val())
        console.log($("#password").val())
        $.ajax({
            url:"/student/login",
            type:"POST",
            data:{
                userName:$("#username").val(),
                password:$("#password").val()
            },
            success: function (rst){
                if (rst.state == 200){
                    window.sessionStorage.setItem("student_id",rst.data.st_ID);
                    window.location.href="/web/studentweb/studentPage.html";

                }else {
                    alert(rst.message);
                }
            }
        });
    });

</script>


<!-- 底部结束 -->

</body>
</html>